<extend name="Category/index" />
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>购买页</title>
	<link rel="stylesheet" href="__PUBLIC__/css/bootstrap.min.css">
    <link rel="stylesheet" href="__PUBLIC__/home/css/buy/buy.css">
    <link rel="stylesheet" href="__PUBLIC__/home/css/iconfont/iconfont.css">
</head>
<body>
<block name="main1">
<link rel="stylesheet" href="__PUBLIC__/home/css/buy/buy.css">
</block>
<block name="main">
	<div class="container">
		<div class="row r">
			<div class="col-md-2">确认订单信息</div>
		</div>
		<div class="row r1">
			<div class="col-md-7">
				<div class="col-md-3">
					<img src="__ROOT__/Uploads/<{$icon.icon|substr=0,8}>/<{$icon.icon|substr=8}>">
				</div>
				<div class="col-md-9">
					<form action="<{:U('Buy/succ',array('sid'=>$data['id']))}>" method="post">
					<h3><{$movie.name}></h3><br>
					<span><{$cinema.name}><{$hall.hall}></span><br>
					<span><{$data['starttime']|date="Y-m-d h:i:s",###}></span><br>
					<input id="price" name="amount" value="<{$data['price']}>"><br>
					<span>
					<div id="btn1">-</div>

					<input type="text" name="num" value="1" id="nb" bz="<{$data['num']}>">
					<div id="btn2">+</div><span id="ba">：张票   
					</span><br>
					<div class="col-md-3 pull-right">
						积分抵扣：<input type="text" name="dikou" ><br>
						剩余积分:<p><{$dikou.score}></p>
					</div>
					
					<button class="btn btn-default" type="submit">确认购买</button>
					</form>
				</div>
			</div>
			<div class="col-md-5">
				<span>取票手机：<{$_SESSION['home_user']['phone']}>> <a href="">修改</a></span><br>
				<p>取票短信可能会被手机软件拦截，请注意！</p>
				<form action="">
					
				</form>
				
			</div>
		</div>
		<!-- <a href="<{:U('Buy/succ',array('sid'=>$data['id'],'amount'=>$data['price']))}>" class="btn btn-default">确认购买</a> -->
	</div>
	<script src="__PUBLIC__/js/jquery.min.js"></script>
    <script src="__PUBLIC__/js/bootstrap.min.js"></script>
    <script>
    	var num = $('#nb').attr('bz');
    	num = Number(num);
    	var price = $('#price').val();
    	$('#btn1,#btn2').click(function(){
    		switch($(this).html()) {
    			case '+':
    			if (isNaN($('#nb').val())) {
 				$('#nb').val(1);
 				$('#price').val(price);
 				
 				//nm = Number(nm);

            	} else{
    			if($('#nb').val() <= 0){
					$('#nb').val('0');
					$('#price').val(price);
					//nm = Number(nm);
					}
				if($('#nb').val() < num){
					var nm = $('#nb').val();
					nm = Number(nm);
					//console.log(typeof(nm));
					$('#nb').val(nm + 1);
					//nm = Number(nm);
					
				}
				if($('#nb').val()> num){
					$('#nb').val(num);
					$('#price').val(price*nm);
					
					//nm = Number(nm);
				}
				nm = $('#nb').val();
				//console.log(nm);
				price = Number(price);
				//console.log(price);
				$('#price').val(price*nm);
				//console.log(vi);
				}
				break;
				case '-':
					if (isNaN($('#nb').val())) {
	 				$('#nb').val(1);
	 				$('#price').val(price);
	            	}
					if($('#nb').val() <= num){
					nm = $('#nb').val();
					nm = Number(nm);
					$('#nb').val(nm - 1);
					nm = $('#nb').val();
					$('#price').val(price*nm);
					//console.log(vi);
				}
					if($('#nb').val() <= 0){
					$('#nb').val(1);
					$('#price').val(price);
					}
					if($('#nb').val()> num){
					$('#nb').val(num);
					nm = $('#nb').val();
					$('#price').val(price*nm);
				}
				break;
    		}
    	})
    </script>
    </block>
</body>
</html>